package logica_de_presentacion;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;

public class JBackGroung extends JDesktopPane {

	/**
	 * Poner un fondo de pantalla en el JDesktop
	 */
	private static final long serialVersionUID = 1L;

	private String path="/logica_de_presentacion/imagenes/fondo.jpg";
	private ImageIcon i;
	
	public JBackGroung(ImageIcon i){
		super();
		this.i=i;
	}
	@Override
	protected void paintComponent(Graphics g) {
		Image img;
		if(i==null){
		img = new ImageIcon(this.getClass().getResource(path))
				.getImage();
		}else{
			img= i.getImage();
		}
		
		Graphics2D g2d = (Graphics2D) g;
		g2d.drawImage(img, 0, 0, this);

	}
}
